#ifndef LISTWIDGET_H
#define LISTWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QStackedWidget>
#include <QThread>
#include <QScrollArea>
#include "loadanimation.h"

#include "timelineview.h"
#include "copytocomputerbuttonwidget.h"
#include "searchedit.h"
#include "publicattributes.hpp"

class MobileFileWidget : public QWidget
{
    Q_OBJECT
public:
    MobileFileWidget(int text, QWidget *parent = nullptr);
    ~MobileFileWidget();

    enum ALL_FILE_LIST_TYPE {
        QQPICTURE,
        QQVIDEO,
        QQMUSIC,
        QQDOCUMENT,
        WECHATPICTURE,
        WECHATVIDEO,
        WECHATMUSIC,
        WECHATDOCUMENT,
        PICTURE,
        VIDEO,
        MUSIC,
        DOCUMENT,
        WECHAT,
        QQ,
        HOMEPAGE
    };
    void showLoadWin();
    //模式切换
    void setMode(QListView::ViewMode mode);
    //设置图片项或者视频项的数据
    void setTimeLineData(const QList<FileInfo> &listStruct);
    //设置音乐项的数据
    void setMusicData(const QList<FileInfo> &listStruct);
    //设置文档项的数据
    void setDocumenData(const QList<FileInfo> &listStruct);
    // 设置缩略图
    void setThumbanil(QString fileName);

    void setViewHeight();

    void setTheme(PublicAttributes::Theme theme);

private Q_SLOTS:
    void slotModeButtonClicked();
    void slotHideCopyToComputerWidget();
    void slotShowCopyButtonWidget();
Q_SIGNALS:
    void sigShowMobileFileListWidget();

    void sigInitFinish();

    void sigSelectDataList(const QList<FileInfo> &fileList);
    void sigSelectAllDataList(const QList<FileInfo> &fileList);
    void sigShowMobileFileSecondWidget(int currentIndexPath);
    void sigUpdateClicked(int);
    void sigModeChange(QListView::ViewMode);
    void sigMenuFilePath(QString filePath);
    void sigChooseFilePath(QString fileName, const QList<FileInfo> &selectFileNameList);
    void sigSetViewHeight();

private:
    TimeLineView *m_timeLineView = nullptr;
    SearchEdit *m_searchLine = nullptr;
    QPushButton *m_searchButton = nullptr;
    QPushButton *m_editButton = nullptr;
    QFrame *m_verticalLineFrame = nullptr;
    QPushButton *m_modeButton = nullptr;
    QStackedWidget *m_stackedWin = nullptr;
    LoadAnimation *m_loadAnimation = nullptr;
    QListView::ViewMode m_mode = QListView::IconMode;
    int m_text;
    CopyToComputerButtonWidget *m_copyButtonMobileFileWidget = nullptr;
    QScrollArea *m_scrollArea = nullptr;

private:
    void initUI();
    void moveCopyToComputerWidget();
    void setEditFocus(bool focus);
public Q_SLOTS:
};

#endif // LISTWIDGET_H
